<%@ page import='es.ats.codington.festival.domain.Event' %>
<%@ page import="java.util.ArrayList" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<link type="text/css" rel="stylesheet" href="css/mystyle.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2"></script>
    <script src="js/login.js"></script>
</head>
<body>

<!--anotacion-->
	

 <div id="container"> <!--para centrar cuadro-->
   <!-- Login Starts Here -->
    <header>
   <nav>
  <ul class="nav1">
  <li id="logo" ><img src="./images/logo.jpg"></li>
<li id="ref1"><a href="ViewMyEventServlet">My Events</a></li>
  <li id="ref1"><a href="modifypassword.jsp">Update password</a></li>
<li id="ref1"><a href="update.jsp">Update information</a></li>


</ul>
</nav>
</header>
  <%String usu=(String)session.getAttribute("username"); %>
<% String pass=(String)session.getAttribute("password"); %>
<div id="loginContainer">
 </form id="loginForm">
 
<form class="UpdatePassServlet" action="LogoutServlet" method="GET" >
			<input id="loginButtonOut" type="submit" value="Logout" />
				<!-- <a href="LogoutServlet" id="loginButtonOut" ><span>Logout</span><em></em></a> -->
				<h3> Bienvenido <%=usu%></h3> 
				</form>

		 </div>
	
	
		<div id="columna">
		
	<div class="Sub_title">
	
        <p>MENU</p>
   	</div>
	
	<div id="header2">
	<ul class="nav2">
		<ul>
			<li><a href="mainpage2.jsp">Home</a></li>
			<br>
			<li><a href="history.jsp">History</a></li>
			<br>
			<li><a href="">North City<br></a>
			<br>
			<ul>
			<div class="menunorth">
			<li><a href="EventByPlaceServletMuseum?type=Museum">Museum</a></li>
			<br>
			<li><a href="EventByPlaceServletTheater?type=Theater">Theater</a></li>
			<br>
			<li><a href="EventByPlaceServletStadium?type=Stadium">Stadium</a></li>
			<br>
			<li><a href="EventByPlaceServletBusiness?type=large Business">Large Business</a></li>
			</div>
			</ul>
			</li>
			<li><a href="">South City</a>
			<ul>
			<div class="menusouth">
			<li><a href="EventByPlaceServletZoo?type=Zoo">Zoo</a></li>
			<br>
			<li><a href="EventByPlaceServletPark?type=Park">Park</a></li>
			<br>
			<li><a href="EventByPlaceServletAttraction?type=Tourist Attraction">Turist Attraction</a></li>
			<br>
			<li><a href="EventByPlaceServletMarket?type=Traditional Market">Traditional Market</a></li>
			</div>
			</ul>
			</li> 
		</ul>
	</ul>
	</div>
	
	</div>
	
	
	<div class="titulo">
        <p>Festival Registration System</p>
   	</div>
	<div class="cuadroblanco">
	<div class="Sub_title">
        <p>New Event Registration Page</p>
   	</div>

	
    <section class="div_borde"> 
	<div id=tabla2>
        <form id="form2" class="ViewAllEventServlet" action="ViewAllEventServlet" method="GET">
			
			
			
			<% Event event  = new Event(); %>
			
			<% event = (Event) request.getAttribute("evento"); %>
		<table>
		
			<tr>
				<td for="eventname"><strong>NAME</strong></td>
				<td for="Places"><strong> DESCRIPTION</strong></td>
				<td for="price" ><strong>PRICE</strong></td>
				<td for="availabletickets" ><strong>SEATS</strong></td>
			</tr>
			
			<tr>
				<td> <%=event.getNamevent()%>  </td>
				<td> <%=event.getDescription()%></td>
				<td> <%=event.getPrice()%></td>
				<td> <%=event.getSeats()%></td>
			</tr>
	
			
			<%   Object iD = session.getAttribute("iDVisitor");
		    int id= (Integer) iD; 
		    
		    if (id==1){%>
		    
		    	<table align="center">
             
                <tr>
                    <td><a href="neweventregistration.jsp?idevent=<%=event.getiDevent()%>">
                                                           
                    <input type="button" value="Update Event">
                    </td>
                                 
                </tr>
            </table>
		    <% }else{
		    	String myString = (String) request.getAttribute("signed");
		    	boolean signed = Boolean.parseBoolean(myString);
		       	if(signed==false){	
		       		if(%><%=event.getSeats()%><% ==0){%> 
		       			<table align="center">
	                 <tr>
	                    <td>This event has no more available seats
	                   </td>
	                </tr>
	            </table>
	            	<%}else{ %>
		       		 <table align="center">
                
                <tr>
                    <td><a href="SingUpForAnEventServlet?idevent=<%=event.getiDevent()%>">
                    <input type="button" value="Register to event">
                    </td>
                
                </tr>
            </table> 
            		<%} 
		       	
		      
            }else{ %>
		    	<table align="center">
                
                
                <tr>
                    <td><a href="UnsignUpForAnEventServlet?idevent=<%=event.getiDevent()%>">
                    <input type="button" value="Unregister to event">
                    </td>
                
                </tr>
            </table>
		    	
		    	
		   <%} %>
				
		
			
			</table>
</form>
</div>
   </section>
		 </br></br>
	</div>
 
 
</body>
</html>